package com.king.string;

import com.google.common.base.Strings;
import com.king.print.Printer;

public class StringsTest {

	public static void main(String...strings) {
		
		Printer.print(Strings.isNullOrEmpty(null));
		Printer.print(Strings.isNullOrEmpty(""));
		Printer.print(Strings.isNullOrEmpty(" "));
		
		// common prefix
		String a = "com.jd.coo.Hello";
		String b = "com.jd.coo.Hi";
		String ourCommonPrefix = Strings.commonPrefix(a,b);
		Printer.print("a,b common prefix is " + ourCommonPrefix);

		// common suffix
		String c = "com.google.Hello";
		String d = "com.jd.Hello";
		String ourSuffix = Strings.commonSuffix(c,d);
		Printer.print("c,d common suffix is " + ourSuffix);
		
		
		int minLength = 14;
		String padEndResult = Strings.padEnd("123", minLength, '0');
		Printer.print("padEndResult is " + padEndResult);

		String padStartResult = Strings.padStart("1", 12, '0');
		Printer.print("padStartResult is " + padStartResult);
		
		// repeat 
		Printer.print(Strings.repeat("hello world", 5));
	}
}
